﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;

namespace ModelCheckUtility.ModelLayer
{
	public class BaseBoundarySegmentPacker : BaseElementPacker_NoneInDic
	{
		public BoundarySegment ThisBoundarySegment
		{
			get
			{
				return this.m_thisBoundarySegment;
			}
		}

		public Curve BoundaryCurve
		{
			get
			{
				return this.m_boundaryCurve;
			}
		}

		public virtual List<BaseDoorPacker> LstDoors
		{
			get
			{
				if (this.m_lstDoors == null)
				{
					this.m_lstDoors = new List<BaseDoorPacker>();
				}
				return this.m_lstDoors;
			}
		}

		public BaseRoomPacker ThisRoomPacker
		{
			get
			{
				return this.m_thisRoomPacker;
			}
			internal set
			{
				this.m_thisRoomPacker = value;
			}
		}

		public BaseBoundarySegmentPacker(BoundarySegment inputValue, Element boundryElement = null, RevitLinkInstance useLinkInstance = null) : base(boundryElement, useLinkInstance, null)
		{
			this.m_thisBoundarySegment = inputValue;
			this.m_boundaryCurve = this.m_thisBoundarySegment.GetCurve();
		}

		public void AddDoor(BaseDoorPacker addedDoor)
		{
			if (addedDoor == null)
			{
				return;
			}
			if (this.m_lstDoors == null)
			{
				this.m_lstDoors = new List<BaseDoorPacker>();
			}
			bool flag = true;
			foreach (BaseDoorPacker baseDoorPacker in this.m_lstDoors)
			{
				if (baseDoorPacker.ThisElementPackerId == addedDoor.ThisElementPackerId)
				{
					flag = false;
					break;
				}
			}
			if (flag)
			{
				this.m_lstDoors.Add(addedDoor);
			}
		}

		private BoundarySegment m_thisBoundarySegment;

		private Curve m_boundaryCurve;

		private List<BaseDoorPacker> m_lstDoors;

		private BaseRoomPacker m_thisRoomPacker;
	}
}
